﻿using SlamDunk.CMS.Model.Base;
using SlamDunk.CMS.Model.ViewModel;

namespace SlamDunk.CMS.Model.DataModel
{
    /// <summary>
    /// 用户
    /// </summary>
    public class User : BaseEntity
    {
        #region # 属性

        #region 用户名 —— string UserName
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; set; }
        #endregion

        #region 密码 —— string Password
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
        #endregion

        #region 真实姓名 —— string RealName
        /// <summary>
        /// 真实姓名
        /// </summary>
        public string RealName { get; set; }
        #endregion

        #region 电话号码 —— string PhoneNumber
        /// <summary>
        /// 电话号码
        /// </summary>
        public string PhoneNumber { get; set; }
        #endregion

        #region 电子邮箱 —— string Email
        /// <summary>
        /// 电子邮箱
        /// </summary>
        public string Email { get; set; }
        #endregion

        #endregion

        #region # 方法

        #region 转换为视图模型 —— UserViewForManage ToViewModel()
        /// <summary>
        /// 转换为视图模型
        /// </summary>
        /// <returns>视图模型</returns>
        public UserViewForManage ToViewModel()
        {
            return new UserViewForManage()
            {
                Id = this.Id,
                UserName = this.UserName,
                Password = this.Password,
                RealName = this.RealName,
                PhoneNumber = this.PhoneNumber,
                Email = this.Email,
                AddTime = this.AddTime.ToString("yyyy-MM-dd HH:mm:ss")
            };
        }
        #endregion

        #endregion
    }
}
